<?php

	$id='';
	if($_GET){
		$id = $_GET['id'];
	}else{
		$id = $_POST['id'];
	}

	$username="u219836729_admin";
	$password="885522";
	$host="mysql.hostinger.es";
	$db="u219836729_raul";


	$conn = mysql_connect($host,$username,$password);
	
	if (!$conn){
		die('No se pudo establecer conexion: ' . mysql_error());
	}
	
	mysql_query('SET NAMES utf8');
	
	if(!mysql_select_db($db)){
		die('No ha sido posible seleccionar la DB: '. mysql_error());
	}
	
	$sql = 'SELECT * FROM agenda WHERE id='. $id;
	$datasource = mysql_query($sql);
	
	if(!$datasource){
		die('No se pudo ejecutar la consulta: '. mysql_error());
	}
	
	while($e = mysql_fetch_assoc($datasource)){
		$output[] = $e;
	}
	
	
	print(json_encode($output));
	
	mysql_close($conn);

?>